package client.ressources;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import gui.Mainframe;

public class W2Eapp {
	
	private Mainframe mainframe;
	private TCPRequest tcprequest;
	
	public W2Eapp() {
		mainframe = new Mainframe();
		
		//initiate actionlisteners here
		mainframe.getHello().addActionListener(new HelloActionListener());
		mainframe.getMenu().addActionListener(new MenuActionListener());
		mainframe.getResult().addActionListener(new ResultActionListener());
	}
	
	public void run() {
		mainframe.show(Mainframe.HELLO);
		mainframe.setVisible(true);
	}
	
	//create actionlisteners here
	private class HelloActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			if (e.getSource() == mainframe.getHello().btnStart()) {
				mainframe.show(Mainframe.MENU);
			}
		}
	}
	
	private class MenuActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			if (e.getSource() == mainframe.getMenu().btnBeef()) {
				System.out.println("Phase #1: 'Beef' button pressed.");
				tcprequest = new TCPRequest("beef");
			}
		}
	}
	
	private class ResultActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			if (e.getSource() == mainframe.getResult().btnBack()) {
				mainframe.show(Mainframe.MENU);
			}
		}
	}

}
